package com.sqllog.admin.sql.mapper;

import com.sqllog.admin.sql.entity.CanalClientConfigInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 客户端配置信息
 *
 * @author chennengcheng
 * @date 2022-01-20 16:13
 * @remark
 */
public interface CanalClientConfigInfoMapper {

    /**
     *
     * @return
     */
    List<CanalClientConfigInfo> selectByAll();

    /**
     *
     * @param id
     * @return
     */
    CanalClientConfigInfo selectById(String id);

    /**
     * 通过host和instanceName
     * @param host
     * @param instanceName
     * @return
     */
    CanalClientConfigInfo  selectByHostAndInstanceName(@Param("host") String host, @Param("instanceName") String instanceName);

    /**
     *
     * @param instanceName
     * @return
     */
    List<CanalClientConfigInfo> selectByInstanceName(@Param("instanceName") String instanceName);

    /**
     * 新增
     * @param canalClientConfigInfo
     */
    boolean insert(CanalClientConfigInfo canalClientConfigInfo);

    /**
     * 删除
     * @param id
     */
    boolean deleteById(String id);

    /**
     *
     * @param status 0: 未启动  1: 正常  2: 启动中  3: 连接异常
     * @param id
     * @return
     */
    boolean updateStatusById(@Param("status") String status, @Param("id") String id);

    /**
     * status 0: 未启动  1: 正常  2: 启动中  3: 连接异常
     * @param status
     * @param host
     * @param instanceName
     * @return
     */
    boolean updateStatusByHostAndName(@Param("errorLog") String errorLog, @Param("status") String status, @Param("host") String host, @Param("instanceName") String instanceName);

    /**
     *
     * @return
     */
    CanalClientConfigInfo selectByHostAndName(@Param("host") String host, @Param("instanceName") String instanceName);

    /**
     * 更新
     */
    boolean updateById(CanalClientConfigInfo canalClientConfigInfo);
}
